<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
    
<%@ page import="javax.swing.JPanel"%>
<%@ page import="java.io.*"%>
<%@ page import="org.jfree.chart.ChartFactory"%>
<%@ page import="org.jfree.chart.ChartPanel"%>
<%@ page import="org.jfree.chart.JFreeChart"%>
<%@ page import="org.jfree.chart.axis.NumberAxis"%>
<%@ page import="org.jfree.chart.plot.CategoryPlot"%>
<%@ page import="org.jfree.chart.plot.PlotOrientation"%>
<%@ page import="org.jfree.data.category.DefaultCategoryDataset"%>
<%@ page import="org.jfree.ui.ApplicationFrame"%>
<%@ page import="org.jfree.ui.RefineryUtilities"%>
<%@ page import="org.jfree.chart.labels.StandardPieToolTipGenerator"%>
<%@ page import="org.jfree.chart.urls.StandardPieURLGenerator"%>
<%@ page import="org.jfree.chart.entity.StandardEntityCollection"%>
<%@ page import="org.jfree.chart.*"%>
<%@ page import="org.jfree.chart.plot.*"%>
<%@ page import="org.jfree.chart.servlet.ServletUtilities"%>
<%@ taglib prefix="s" uri="/struts-tags" %>

<h3>Monitor & Report</h3>
<ul>
	<li><a href='share-pool'>Shared Pool</a></li>
	<li><a href='buffer-cache'>Buffer Cache</a></li>
	<li><a href='redo-log'>Redo Log Buffer/Files</a></li>
	<li><a href='memory-sort'>Memory area used for sorting</a></li>
	<li><a href='rollback-segment'>Rollback segments</a></li>
</ul>

<br />

<h3>Threshold Configuration</h3>
<ul>
	<li>Shared Pool</li>
	<li>Buffer Cache</li>
	<li>Redo Log Buffer/Files</li>
	<li>Memory area used for sorting</li>
	<li>Rollback segments</li>
</ul>

<h3><a href='debug-interface'>Debug Interface</a></h3>


<%
            DefaultCategoryDataset linedataset = new DefaultCategoryDataset();
  			// line name
  			String series1 = "a";
  			String series2 = "b";
  			String series3 = "c";

  			// x-range name
  			String type1 = "0";
  			String type2 = "1";
  			String type3 = "2";
  			String type4 = "3";
  			String type5 = "4";
  			String type6 = "5";
  			String type7 = "6";
  			String type8 = "7";
  			String type9 = "8";
  			String type10 = "9";
  			String type11 = "10";
  			String type12 = "11";
  			

  			// dataset 1
  			// addValue(value, line name, x - range)
  			linedataset.addValue(0.0, series1, type1);
  			linedataset.addValue(1.2, series1, type2);
  			linedataset.addValue(1.2, series1, type3);
  			linedataset.addValue(1.2, series1, type4);
  			linedataset.addValue(1.2, series1, type5);
  			linedataset.addValue(1.2, series1, type6);
  			linedataset.addValue(1.9, series1, type7);
  			linedataset.addValue(2.2, series1, type8);
  			linedataset.addValue(2.9, series1, type9);
  			linedataset.addValue(3.2, series1, type10);
  			linedataset.addValue(3.9, series1, type11);
  			linedataset.addValue(4.2, series1, type12);

  			// dataset 2 - threshold
  			linedataset.addValue(2.0, series2, type1);
  			linedataset.addValue(2.0, series2, type2);
 			linedataset.addValue(2.0, series2, type3);

 			// dataset 3 - threshold
 			linedataset.addValue(5.0, series3, type1);
  			linedataset.addValue(5.0, series3, type2);
 			linedataset.addValue(5.0, series3, type3);
            
			//create the chart
  			JFreeChart chart = ChartFactory.createLineChart(
  				"title name", // chart title
    			"x label name", // x label name
    			"y label name", // y label name
    			linedataset, // data
    			PlotOrientation.VERTICAL, // orientation
    			true, // include legend
    			true, // tooltips
    			false // urls
   		 	);
 			CategoryPlot plot = chart.getCategoryPlot();
  			// customise the range axis...
  			NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis();
 			rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
  			rangeAxis.setAutoRangeIncludesZero(true);
  			rangeAxis.setUpperMargin(0.20);
  			rangeAxis.setLabelAngle(Math.PI / 2.0);

            StandardEntityCollection sec = new StandardEntityCollection(); 
            ChartRenderingInfo info = new ChartRenderingInfo(sec); 
            PrintWriter w = new PrintWriter(out);
			String filename = ServletUtilities.saveChartAsJPEG(chart,500,300,info,session); 
            ChartUtilities.writeImageMap(w,"map0",info,false); 

            String graphURL = request.getContextPath() + "/servlet/DisplayChart?filename=" + filename;
%> 

<P ALIGN="CENTER"> 
<img src="<%= graphURL %>" width=500 height=300 border=0 usemap="#map0"> 
</P> 
<br />
